A Variant of Heapsort with Almost Optimal Number of Comparisons
نویسنده
چکیده
An algorithm, which asymptotically halves the number of comparisons made by the common HEAPSORT, is presented and analysed in the worst case. The number of comparisons is shown to be (n+ 1)(log(n+ 1) + log log(n+ 1) + 1.82) + O(log n) in the worst case to sort n elements, without using any extra space. QUICKSORT, which usually is referred to as the fastest in-place sorting method, uses 1.38n log n O(n) in the average case (see Gonnet (1984)).
منابع مشابه
A New Data Structure for Heapsort with Improved Number of Comparisons
In this paper we present a new data structure for implementing heapsort algorithm for pairs of which can be simultaneously stored and processed in a single register. Since time complexity of Carlsson type variants of heapsort has already achieved a leading coefficient of 1, concretely n lgn + n lg lg n, and lower bound theory asserts that no comparison based in-place sorting algorithm can sort ...
متن کاملPushing the Limits in Sequential Sorting
With re nements to the WEAK-HEAPSORT algorithm we establish the general and practical relevant sequential sorting algorithm RELAXED-WEAK-HEAPSORT executing exactly ndlog ne 2 ne + 1 n log n 0:9n comparisons on any given input. The number of transpositions is bounded by n plus the number of comparisons. Experiments show that RELAXED-WEAK-HEAPSORT only requires O(n) extra bits. Even if this space...
متن کاملOn the Performance of WEAK-HEAPSORT
Dutton (1993) presents a further HEAPSORT variant called WEAK-HEAPSORT, which also contains a new data structure for priority queues. The sorting algorithm and the underlying data structure are analyzed showing that WEAK-HEAPSORT is the best HEAPSORT variant and that it has a lot of nice properties. It is shown that the worst case number of comparisons is ndlog ne 2 ne + n dlog ne n log n+ 0:1n...
متن کاملTwo Constant-Factor-Optimal Realizations of Adaptive Heapsort
In this paper we introduce two efficient priority queues. For both, insert requires O(1) amortized time and extract-min O(lgn) worstcase time including at most lgn+O(1) element comparisons, where n is the number of elements stored. One priority queue is based on a weak heap (array-based) and the other on a weak queue (pointer-based). In both, the main idea is to temporarily store the inserted e...
متن کاملThe Ultimate Heapsort
A variant of Heapsort|named Ultimate Heapsort|is presented that sorts n elements in-place in (n log 2 (n + 1)) worst-case time by performing at most n log 2 n + (n) key comparisons and n log 2 n + (n) element moves. The secret behind Ultimate Heapsort is that it occasionally transforms the heap it operates with to a two-layer heap which keeps small elements at the leaves. Basically, Ultimate He...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید
ثبت ناماگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید
ورودعنوان ژورنال:
- Inf. Process. Lett.
دوره 24 شماره
صفحات -
تاریخ انتشار 1987